package com.aiti.lulian.controller.gongxin;

import com.aiti.base.core.base.controller.WebController;
import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.dto.gonxin.SupplyAndDemandDto;
import com.aiti.lulian.service.ISupplyAndDemandDatabaseService;
import com.aiti.lulian.vo.gongxin.SupplyAndDemandVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "供需库控制层")
@RestController
@RequestMapping("/supplyAndDemandDB")
public class SupplyAndDemandDatabaseController extends WebController {

    @Autowired
    private ISupplyAndDemandDatabaseService supplyAndDemandDatabaseService;

    @ApiOperation("查询供需列表")
    @GetMapping("list")
    public Message list(SupplyAndDemandDto dto) {
        Page<SupplyAndDemandVo> page = startPage();
        List<SupplyAndDemandVo> list = supplyAndDemandDatabaseService.list(page, dto);
        return Message.success(getPageResult(list, dto.getPageNum(), dto.getPageSize(), page.getTotal()));
    }
}
